package NPE_RET;

import java.io.*;

public class Example {
    Reader getReader(String configurationPath) throws IOException {
        File file = new File(configurationPath);
        if (file.exists()) {
            return new BufferedReader(new FileReader(file));
        }
        return null;
    }


    Reader getDefaultReader() throws IOException {
        return getReader("conf");
    }

    public void init() throws IOException {
        load(getDefaultReader());
    }

    private String load(Reader reader) throws IOException {
        StringBuffer sb = new StringBuffer();

        char[] buffer = new char[1024];
        int length;
        while ((length = reader.read(buffer)) > 0) {
            sb.append(buffer, 0, length);
        }
        return sb.toString();
    }
}
